-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Violation Highlight Styles #28
Improve Violation Highlight Styles #28
Conversation
hsla(166, 44%, 65%, 1.00) 1.2em, | ||
hsla(214, 96%, 45%, 1.00) 1.2em, | ||
hsla(214, 96%, 45%, 1.00) 1.6em | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to !important
this since the specificity here is very low.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I wanted to bring this up as an open question as well.
Part of me feels like it would be good to leave off !important
here. The low specificity isn't too concerning so long as no one defines their own .axe-violation
rules (i.e: we're not just trying to target div
or something) -- and if they do, that may well be a valid use case that we shouldn't get in the way of.
But then I can see the other side: .axe-violation
is our special sauce -- and, for their own good, someone using ember-a11y-testing
shouldn't try to override it, as it would only add ambiguity to their markup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm more saying that another selector targeting an invalid element like #something .blue-background
will win compared to ours without !important
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh.... yep, that's absolutely true. I was only considering using the same class. Thanks for thinking outside of the box model.
That is certainly going to get somebody's attention! I like the solution. A lot. You have a couple of failing tests that seem like they're simply relying on an element's existence which can be |
0fc31b4
to
f5c91eb
Compare
3d2983f
to
7769ec2
Compare
I like it. It's also possible that we should scale the background-image to make sure that tiny elements still get "striped." |
bc33251
to
8729243
Compare
@nathanhammond Hmm... if I'm understanding what you're getting at by "scale", that's what I had in mind by using percentage values for the gradient stops to render the screenshot above (the percentage being relative to the container size along the gradient axis):
* Variables here are from the Codepen, but raw values are all we'd actually use. More to that point, though, I'm also leaning towards if ... Kind of digging the ems 😄. |
5db2727
to
2ee1e60
Compare
import Ember from 'ember'; | ||
|
||
export default Ember.Route.extend({ | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can delete this file.
@BrianSipple Turns out I didn't understand your code and you were already way ahead of me on this. I like the way the smaller sizes work out. At this point I'm deferring to your implementation. I have no additional comments on the code. So, .
Let's keep this in our back pocket and watch for feature requests as they come in that can be solved with this. |
c3ed436
to
8ecfe65
Compare
This PR attempts to address some of the challenges outlined in #19 -- which seems like a great use case for striped gradients. (@nathanhammond, your right on that it would be difficult to define a color that will apply to all UI styles but with striped gradients, we aren't limited to just one 😀).
I put together a Codepen demo with some of the ideas that I've been prototyping for a violation warning -- which includes a few variants of striped repeating linear gradients and SVG filters. And at the moment, I decided on this:
The color scheme (transparent / mint-yellow / aqua-green / navy-blue, seen here over a black background) was chosen so that it will provide a strong contrast against either light or dark background -- with special care to ensure that this was also true for color-blind users. I also added a rule that removes the gradient on hover so that a user can always inspect the original element when they see the warning appear over it. Overall, this approach feels a lot more clean and performant than creating new markup and trying to perform reads/writes in the DOM to position it correctly over each component.
But that's just our default. Which takes effect by the
audit
function applying theaxe-violation
class to offending nodes. For customization purposes, I added logic that allows a user to have their own classes applied instead -- by exposing anaxeViolationClassNames
property that takes an array of user-provided class names. This array then gets used instead of our default name when theaudit
function adds classes:The more I think about it, this can also be one of the options we allow at the ENV config level while we're at it.
Furthermore, if someone really wants to do heavy stuff with their violating components in JavaScript, they'd already have the ability to do that through the
axeCallback
that we support. Perhaps we could add a few "recipes" to the README for how to do this if it seems like there's a significant use case?